package initialize

import (
	"github.com/gin-gonic/gin"
	"new_club_recruitment/global"
	"new_club_recruitment/router"
)

//Routers 初始化总路由
func Routers() *gin.Engine {
	Router := gin.Default()
	//设置路由组
	//Router.POST("/login", api.ApiGroupApp.AdminApiGroup.Login)
	PrivateGroup := Router.Group("")
	systemRouter := router.RouterGroupApp.System
	systemRouter.InitBaseRouter(PrivateGroup)
	systemRouter.InitRedEnvelopeRouter(PrivateGroup)
	systemRouter.InitWeChatPayRouter(PrivateGroup)
	//使用中间件
	//PrivateGroup.Use(middleware.JWTAuthMiddleware(), middleware.CasbinHandler())
	adminRouter := router.RouterGroupApp.Admin
	userRouter := router.RouterGroupApp.User
	adminRouter.InitAdminRouter(PrivateGroup)
	adminRouter.InitExcelRouter(PrivateGroup)
	userRouter.InitUserRouter(PrivateGroup)
	userRouter.InitChannelRouter(PrivateGroup)
	global.GVA_LOG.Info("router register success")
	return Router
}
